package com.cindata

/**
 * 租售比*/
class CommunityRentalRatio
{

    Long communityId
    String risk
    Integer currentPrice
    BigDecimal currentRental
    BigDecimal ratio
    Integer cityRank

    String statsDate

    static constraints = {
        risk nullable: true, blank: true, maxSize: 64
        currentPrice nullable: true, blank: true
        currentRental nullable: true, blank: true
        ratio precision: 5, scale: 5, nullable: true, blank: true
        statsDate nullable: true, blank: true, maxSize: 10
        cityRank nullable: true, blank: true
    }

    def ratioShow()
    {
        if (!ratio)
        {
            return '-:-'
        }
        else
        {
            def tmp_ratio = 1 / ratio as int
            return "1:${tmp_ratio}"
        }
    }
}
